/*********************************************************************************
 * 
 * Author: wujunjie
 * Create Date: 2014-05-10
 * Description:
 *          
 * Revision History:
 *      Date          Author               Description
 * 
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataFrameworkAccess;
using Xinkui.Entity.AutoGenerator;
using Xinkui.Common;
namespace Xinkui.DataAccess.AutoGenerator {
    public partial class BuyleadInfoDataAccess
    {
        public List<BuyleadInfo_Entity> BuyleadInfo_ListByPaging(int pageSize, int pageIndex,out int total)
        {
			total= 0;
            try
            {
				int tempRecord = 0;
                DataCommand cmd = DataCommandManager.GetDataCommand("BuyleadInfo_ListByPaging");
                cmd.SetParameterValue("@PageSize", pageSize);
                cmd.SetParameterValue("@PageIndex", pageIndex);
				cmd.SetParameterValue("@RecordCount", tempRecord);
                List<BuyleadInfo_Entity> pageList = cmd.ExecuteEntityList<BuyleadInfo_Entity>();
                total = Convert.ToInt32(cmd.GetParameterValue("@RecordCount"));
				return pageList;
            }
            catch (Exception ex)
            {
                ExceptionHelper.ProcessException(ex);
            }

            return new List<BuyleadInfo_Entity>(0);

        }

        public BuyleadInfo_Entity BuyleadInfo_View(System.Int32 BuyleadID)
        {
            BuyleadInfo_Entity c = default(BuyleadInfo_Entity);
            try
            {
                DataCommand cmd = DataCommandManager.GetDataCommand("BuyleadInfo_View");
                cmd.SetParameterValue("@BuyleadID", BuyleadID);
                c = cmd.ExecuteEntity<BuyleadInfo_Entity>();
            }
            catch (Exception ex)
            {
                ExceptionHelper.ProcessException(ex);
            }
            return c;
        }

        public BuyleadInfo_Entity BuyleadInfo_Add(BuyleadInfo_Entity entity)
        {
            try
            {
                DataCommand cmd = DataCommandManager.GetDataCommand("BuyleadInfo_Add");
                cmd.SetParameterValue("@BuyleadID", entity.BuyleadID);
                cmd.SetParameterValue("@Subject", entity.Subject);
                cmd.SetParameterValue("@CategoryID", entity.CategoryID);
                cmd.SetParameterValue("@MainKeyword", entity.MainKeyword);
                cmd.SetParameterValue("@Keywords", entity.Keywords);
                cmd.SetParameterValue("@PurchaseType", entity.PurchaseType);
                cmd.SetParameterValue("@Details", entity.Details);
                cmd.SetParameterValue("@OEMNO", entity.OEMNO);
                cmd.SetParameterValue("@Packing", entity.Packing);
                cmd.SetParameterValue("@Quantity", entity.Quantity);
                cmd.SetParameterValue("@ValidDate", entity.ValidDate);
                cmd.SetParameterValue("@ValidTime", entity.ValidTime);
                cmd.SetParameterValue("@PriceRange", entity.PriceRange);
                cmd.SetParameterValue("@CertificationRequirements", entity.CertificationRequirements);
                cmd.SetParameterValue("@OrderQuantity", entity.OrderQuantity);
                cmd.SetParameterValue("@CompanyID", entity.CompanyID);
                cmd.SetParameterValue("@UserID", entity.UserID);
                cmd.SetParameterValue("@CreateDate", entity.CreateDate);
                cmd.SetParameterValue("@UpdateDate", entity.UpdateDate);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                ExceptionHelper.ProcessException(ex);
            }

            return entity;
        }

        public bool BuyleadInfo_Update(BuyleadInfo_Entity entity)
        {
            bool succ = false;
            try
            {
                DataCommand cmd = DataCommandManager.GetDataCommand("BuyleadInfo_Update");
                cmd.SetParameterValue("@BuyleadID", entity.BuyleadID);
                cmd.SetParameterValue("@Subject", entity.Subject);
                cmd.SetParameterValue("@CategoryID", entity.CategoryID);
                cmd.SetParameterValue("@MainKeyword", entity.MainKeyword);
                cmd.SetParameterValue("@Keywords", entity.Keywords);
                cmd.SetParameterValue("@PurchaseType", entity.PurchaseType);
                cmd.SetParameterValue("@Details", entity.Details);
                cmd.SetParameterValue("@OEMNO", entity.OEMNO);
                cmd.SetParameterValue("@Packing", entity.Packing);
                cmd.SetParameterValue("@Quantity", entity.Quantity);
                cmd.SetParameterValue("@ValidDate", entity.ValidDate);
                cmd.SetParameterValue("@ValidTime", entity.ValidTime);
                cmd.SetParameterValue("@PriceRange", entity.PriceRange);
                cmd.SetParameterValue("@CertificationRequirements", entity.CertificationRequirements);
                cmd.SetParameterValue("@OrderQuantity", entity.OrderQuantity);
                cmd.SetParameterValue("@CompanyID", entity.CompanyID);
                cmd.SetParameterValue("@UserID", entity.UserID);
                cmd.SetParameterValue("@CreateDate", entity.CreateDate);
                cmd.SetParameterValue("@UpdateDate", entity.UpdateDate);
                cmd.ExecuteNonQuery();
                succ = true;
            }
            catch (Exception ex)
            {
                ExceptionHelper.ProcessException(ex);
            }
            return succ;
        }

        public bool BuyleadInfo_Delete(System.Int32 BuyleadID)
        {
            bool succ = false;
            try
            {
                DataCommand cmd = DataCommandManager.GetDataCommand("BuyleadInfo_Delete");
                cmd.SetParameterValue("@BuyleadID", BuyleadID);
                cmd.ExecuteNonQuery();
                succ = true;
            }
            catch (Exception ex)
            {
                ExceptionHelper.ProcessException(ex);
            }
            return succ;
        }
		
	}
}
